package designPattern.state
{
	import flash.net.NetStream;
	
	public class Works implements IWorks
	{
		private var state:IState;
		private var playState:IState;
		private var stopState:IState;
		private var pauseState:IState;
		
		public function Works()
		{
			playState = new PlayState(this);
			stopState = new StopState(this);
			pauseState = new PauseState(this);
			state = stopState;//初始将状态设置为stopState
		}
		
		public function getState():IState
		{
			return this.state;
		}
		
		public function setState(s:IState):void
		{
			this.state = s;
		}
		
		public function getPlayState():IState
		{
			return this.playState;
		}
		
		public function getStopState():IState
		{
			return this.stopState;
		}
		
		public function getPauseState():IState
		{
			return this.pauseState;
		}
		
		
		///
		public function startPlay(ns:NetStream, url:String):void
		{
			state.startPlay(ns, url);
		}
		
		public function startStop(ns:NetStream):void
		{
			state.startStop(ns);
		}
		
		public function doPause(ns:NetStream):void
		{
			state.doPause(ns);
		}
	}
}